/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.img;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;

/**
 * <p>Project: app2022 - Img2
 * <p>Powered by webrx On 2022-01-21 09:03:55
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Img2 {
    public static void main(String[] args) throws Exception {
        var i2 = new BufferedImage(500, 500, 1);//jpg
        var i3 = new BufferedImage(500, 500, 2);//png
        var i = new BufferedImage(500, 500, 10);//gray 灰度
        var g = i.createGraphics();
        g.setColor(Color.RED);
        g.drawLine(0, 0, 500, 500);
        g.dispose();
        ImageIO.write(i, "png", new File("i.png"));
        Runtime.getRuntime().exec("cmd /k start i.png");
    }
}
